home *** CD-ROM | disk | FTP | other *** search
/ User's Choice Windows CD / User's Choice Windows CD (CMS Software)(1993).iso / misc1 / iv26_w30.zip / EXAMPLES / IDRAW / MAIN.C < prev    next >
C/C++ Source or Header  |  1992-03-12  |  5KB  |  128 lines

  1. /*
  2.  * Copyright (c) 1987, 1988, 1989 Stanford University
  3.  *
  4.  * Permission to use, copy, modify, distribute, and sell this software and its
  5.  * documentation for any purpose is hereby granted without fee, provided
  6.  * that the above copyright notice appear in all copies and that both that
  7.  * copyright notice and this permission notice appear in supporting
  8.  * documentation, and that the name of Stanford not be used in advertising or
  9.  * publicity pertaining to distribution of the software without specific,
  10.  * written prior permission.  Stanford makes no representations about
  11.  * the suitability of this software for any purpose.  It is provided "as is"
  12.  * without express or implied warranty.
  13.  *
  14.  * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  15.  * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
  16.  * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  17.  * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  18.  * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  19.  * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
  20.  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  21.  */
  22.  
  23. // $Header: main.c,v 1.11 89/10/09 14:48:57 linton Exp $
  24. // runs idraw.
  25.  
  26. #include "idraw.h"
  27. #include <InterViews/world.h>
  28.  
  29. // Predefine default properties for the window size, paint menus, and
  30. // history.
  31.  
  32. static PropertyData properties[] = {
  33.     { "*font1",        "*-courier-medium-r-*-80-*    Courier 8" },
  34.     { "*font2",        "*-courier-medium-r-*-100-*   Courier 10" },
  35.     { "*font3",        "*-courier-bold-r-*-120-*     Courier-Bold 12" },
  36.     { "*font4",        "*-helvetica-medium-r-*-120-* Helvetica 12" },
  37.     { "*font5",        "*-helvetica-medium-r-*-140-* Helvetica 14" },
  38.     { "*font6",        "*-helvetica-bold-r-*-140-*   Helvetica-Bold 14" },
  39.     { "*font7",        "*-helvetica-medium-o-*-140-* Helvetica-Oblique 14" },
  40.     { "*font8",        "*-times-medium-r-*-120-*     Times-Roman 12" },
  41.     { "*font9",        "*-times-medium-r-*-140-*     Times-Roman 14" },
  42.     { "*font10",    "*-times-bold-r-*-140-*       Times-Bold 14" },
  43.     { "*font11",    "*-times-medium-i-*-140-*     Times-Italic 14" },
  44.     { "*brush1",    "none" },
  45.     { "*brush2",    "ffff 1 0 0" },
  46.     { "*brush3",    "ffff 1 1 0" },
  47.     { "*brush4",    "ffff 1 0 1" },
  48.     { "*brush5",    "ffff 1 1 1" },
  49.     { "*brush6",    "3333 1 0 0" },
  50.     { "*brush7",    "3333 2 0 0" },
  51.     { "*brush8",    "ffff 2 0 0" },
  52.     { "*pattern1",    "none" },
  53.     { "*pattern2",    "0.0" },
  54.     { "*pattern3",    "1.0" },
  55.     { "*pattern4",    "0.75" },
  56.     { "*pattern5",    "0.5" },
  57.     { "*pattern6",    "0.25" },
  58.     { "*pattern7",    "1248" },
  59.     { "*pattern8",    "8421" },
  60.     { "*pattern9",    "f000" },
  61.     { "*pattern10",    "8888" },
  62.     { "*pattern11",    "f888" },
  63.     { "*pattern12",    "8525" },
  64.     { "*pattern13",    "cc33" },
  65.     { "*pattern14",    "7bed" },
  66.     { "*fgcolor1",    "Black" },
  67.     { "*fgcolor2",    "Brown 42240 10752 10752" },
  68.     { "*fgcolor3",    "Red" },
  69.     { "*fgcolor4",    "Orange" },
  70.     { "*fgcolor5",    "Yellow" },
  71.     { "*fgcolor6",    "Green" },
  72.     { "*fgcolor7",    "Blue" },
  73.     { "*fgcolor8",    "Indigo 48896 0 65280" },
  74.     { "*fgcolor9",    "Violet 20224 12032 20224" },
  75.     { "*fgcolor10",    "White" },
  76.     { "*fgcolor11",    "LtGray 50000 50000 50000" },
  77.     { "*fgcolor12",    "DkGray 33000 33000 33000" },
  78.     { "*bgcolor1",    "Black" },
  79.     { "*bgcolor2",    "Brown 42240 10752 10752" },
  80.     { "*bgcolor3",    "Red" },
  81.     { "*bgcolor4",    "Orange" },
  82.     { "*bgcolor5",    "Yellow" },
  83.     { "*bgcolor6",    "Green" },
  84.     { "*bgcolor7",    "Blue" },
  85.     { "*bgcolor8",    "Indigo 48896 0 65280" },
  86.     { "*bgcolor9",    "Violet 20224 12032 20224" },
  87.     { "*bgcolor10",    "White" },
  88.     { "*bgcolor11",    "LtGray 50000 50000 50000" },
  89.     { "*bgcolor12",    "DkGray 33000 33000 33000" },
  90.     { "*initialfont",    "2" },
  91.     { "*initialbrush",    "2" },
  92.     { "*initialpattern","2" },
  93.     { "*initialfgcolor","1" },
  94.     { "*initialbgcolor","10" },
  95.     { "*history",    "20" },
  96.     { "*reverseVideo",    "off" },
  97.     { "*small",        "true" },
  98.     { nil }
  99. };
  100.  
  101. // Define window size options.
  102.  
  103. static OptionDesc options[] = {
  104.     { "-l", "*small", OptionValueImplicit, "false" },
  105.     { "-s", "*small", OptionValueImplicit, "true" },
  106.     { nil }
  107. };
  108.  
  109. // main creates a connection to the display server, creates idraw, and
  110. // opens idraw's window.  After idraw stops running, main closes
  111. // idraw's window, deletes everything it created, and returns success.
  112.  
  113.  
  114. int IVMain (int argc, char** argv) {
  115.     World* world = new World("Idraw", properties, options, argc, argv);
  116.     Idraw* idraw = new Idraw(argc, argv);
  117.  
  118.     world->InsertApplication(idraw);
  119.     idraw->Run();
  120.     world->Remove(idraw);
  121.  
  122.     delete idraw;
  123.     delete world;
  124.  
  125.     const int SUCCESS = 0;
  126.     return SUCCESS;
  127. }
  128.